home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / role / pinfocom_3_0.lha / Source / amiga_global.h < prev    next >
C/C++ Source or Header  |  1992-10-22  |  10KB  |  419 lines

  1. /* amiga_global.h
  2.  *
  3.  *  ``pinfocom'' -- a portable Infocom Inc. data file interpreter.
  4.  *  Copyright (C) 1987-1992  InfoTaskForce
  5.  *
  6.  *  This program is free software; you can redistribute it and/or modify
  7.  *  it under the terms of the GNU General Public License as published by
  8.  *  the Free Software Foundation; either version 2 of the License, or
  9.  *  (at your option) any later version.
  10.  *
  11.  *  This program is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *  GNU General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU General Public License
  17.  *  along with this program; see the file COPYING.  If not, write to the
  18.  *  Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. /*
  22.  * $Header: RCS/amiga_global.h,v 3.0 1992/10/21 16:56:19 pds Stab $
  23.  */
  24.  
  25. #define _AMIGA_GLOBAL_H    1
  26.  
  27.     /* Amiga interpreter version and revision. */
  28.  
  29. #define    AMIGA_VERSION    2
  30. #define AMIGA_REVISION    20
  31.  
  32. #define VERSION_STRING    "\0$VER: AmigaInfocom 2.20 (6.10.92)"
  33.  
  34.     /* Stop GCC from complaining. */
  35.  
  36. #ifdef __GNUC__
  37. #include <inline/stubs.h>
  38. #endif    /* __GNUC__ */
  39.  
  40.     /* System library includes. */
  41.  
  42. #include <intuition/intuitionbase.h>
  43. #include <graphics/displayinfo.h>
  44. #include <workbench/workbench.h>
  45. #include <libraries/iffparse.h>
  46. #include <libraries/gadtools.h>
  47. #include <graphics/gfxmacros.h>
  48. #include <libraries/diskfont.h>
  49. #include <workbench/startup.h>
  50. #include <graphics/gfxbase.h>
  51. #include <devices/conunit.h>
  52. #include <devices/audio.h>
  53. #include <devices/timer.h>
  54. #include <exec/execbase.h>
  55. #include <libraries/asl.h>
  56. #include <dos/dosextens.h>
  57. #include <exec/devices.h>
  58. #include <exec/memory.h>
  59. #include <dos/dostags.h>
  60. #include <clib/macros.h>
  61.  
  62.     /* System library prototypes. */
  63.  
  64. #include <clib/intuition_protos.h>
  65. #include <clib/graphics_protos.h>
  66. #include <clib/iffparse_protos.h>
  67. #include <clib/diskfont_protos.h>
  68. #include <clib/gadtools_protos.h>
  69. #include <clib/utility_protos.h>
  70. #include <clib/console_protos.h>
  71. #include <clib/exec_protos.h>
  72. #include <clib/icon_protos.h>
  73. #include <clib/alib_protos.h>
  74. #include <clib/asl_protos.h>
  75. #include <clib/dos_protos.h>
  76. #include <clib/wb_protos.h>
  77.  
  78.     /* Standard ANSI `C' includes. */
  79.  
  80. #include <string.h>
  81. #include <stdarg.h>
  82. #include <stdlib.h>
  83. #include <stdio.h>
  84. #include <ctype.h>
  85.  
  86.     /* Some help to keep the code size down. */
  87.  
  88. #ifdef AZTEC_C
  89.  
  90. #include <pragmas/utility_lib.h>
  91. #include <pragmas/exec_lib.h>
  92.  
  93. #endif    /* AZTEC_C */
  94.  
  95. #ifdef LATTICE
  96.  
  97. #include <pragmas/utility_pragmas.h>
  98. #include <pragmas/exec_pragmas.h>
  99.  
  100. #endif    /* LATTICE */
  101.  
  102.     /* We will try to block signal handling for GCC. */
  103.  
  104. #ifdef __GNUC__
  105.  
  106. #include <signal.h>
  107.  
  108.     /* Signals to trap while running. */
  109.  
  110. #define TRAPPED_SIGNALS (sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGILL)|sigmask(SIGTRAP)|sigmask(SIGABRT)|sigmask(SIGEMT)|sigmask(SIGFPE)|sigmask(SIGBUS)|sigmask(SIGSEGV)|sigmask(SIGSYS)|sigmask(SIGALRM)|sigmask(SIGTERM)|sigmask(SIGTSTP))
  111.  
  112. #endif    /* __GNUC__ */
  113.  
  114.     /* Local header files. */
  115.  
  116. #include "patchlevel.h"
  117. #include "infocom.h"
  118.  
  119.     /* Options changeable at runtime. */
  120.  
  121. enum    {    OPTION_ATTRIBUTE_ASSIGNMENTS, OPTION_ATTRIBUTE_TESTS, OPTION_ECHO, OPTION_PAGING,
  122.         OPTION_PROMPT, OPTION_STATUS, OPTION_TANDY, OPTION_XFERS };
  123.  
  124.     /* Screen colour types. */
  125.  
  126. enum    {    COLOUR_INPUT, COLOUR_STATUS, COLOUR_TEXT, COLOUR_SPECIAL, COLOUR_ERROR };
  127.  
  128.     /* Cursor width codes. */
  129.  
  130. enum    {    CURSOR_AVERAGE = -1, CURSOR_NOCHANGE = 0 };
  131.  
  132.     /* Save file requester choices. */
  133.  
  134. enum    {    SAVE_CANCEL, SAVE_PROCEED, SAVE_NEWNAME };
  135.  
  136.     /* Serial and release number table entries. */
  137.  
  138. enum    {    SERIAL_INDEX, SERIAL_RELEASE, SERIAL_NUMBER };
  139.  
  140.     /* Menu numbers. */
  141.  
  142. enum    {    MENU_PROJECT, MENU_EDIT, MENU_COMMANDS, MENU_STORY, MENU_OPTIONS };
  143.  
  144.     /* Selected menu item codes. */
  145.  
  146. enum    {    PROJECTMENU_ABOUT = 0, PROJECTMENU_SCRIPT = 5 };
  147.  
  148. enum    {    EDITMENU_CUT = 0, EDITMENU_COPY = 1, EDITMENU_PASTE = 2, EDITMENU_UNDO = 4};
  149.  
  150. enum    {    OPTIONSMENU_ATTRIBUTE_ASSIGNMENTS, OPTIONSMENU_ATTRIBUTE_TESTS, OPTIONSMENU_ECHO,
  151.         OPTIONSMENU_PAGING, OPTIONSMENU_PROMPT, OPTIONSMENU_STATUS, OPTIONSMENU_TANDY,
  152.         OPTIONSMENU_XFERS };
  153.  
  154.     /* Chipdata offsets. */
  155.  
  156. enum    {    CHIPDATA_PATTERN, CHIPDATA_POINTER=2 };
  157.  
  158.     /* Transcript control panel gadget IDs. */
  159.  
  160. enum    {    SCRIPTGAD_PRINTER_STRING, SCRIPTGAD_PRINTER_WIDTH, SCRIPTGAD_PRINTER_ACCEPT,
  161.         SCRIPTGAD_PRINTER_CANCEL, SCRIPTGAD_PRINTER_SELECT };
  162.  
  163.     /* Script file requester choices. */
  164.  
  165. enum    {    SCRIPT_CANCEL, SCRIPT_PROCEED, SCRIPT_APPEND, SCRIPT_NEWNAME };
  166.  
  167.     /* Two handy gadget data access macros. */
  168.  
  169. #define GT_STRING(G)        (((struct StringInfo *)(((struct Gadget *)(G)) -> SpecialInfo)) -> Buffer)
  170. #define GT_INTEGER(G)        (((struct StringInfo *)(((struct Gadget *)(G)) -> SpecialInfo)) -> LongInt)
  171.  
  172.     /* A macro to attach the stopwatch mouse pointer to a window. */
  173.  
  174. #define WaitPointer(Window)    SetPointer(Window,&ChipData[CHIPDATA_POINTER],STOPWATCH_HEIGHT,STOPWATCH_WIDTH,STOPWATCH_LEFT_OFFSET,STOPWATCH_TOP_OFFSET)
  175.  
  176.     /* Chunk IDs required by the clipboard code. */
  177.  
  178. #define ID_FTXT            MAKE_ID('F','T','X','T')
  179. #define ID_CHRS            MAKE_ID('C','H','R','S')
  180.  
  181.     /* Window/Screen title text. */
  182.  
  183. #define SCREEN_TITLE        "Portable Infocom Datafile Interpreter  Copyright \251 1987-1992 InfoTaskForce"
  184.  
  185.     /* Number of function keys. */
  186.  
  187. #define NUM_FKEYS        20
  188.  
  189.     /* Number of additional icon tool type entries. */
  190.  
  191. #define NUM_OPTIONS        13
  192.  
  193.     /* Number of menu entries. */
  194.  
  195. #define NUM_MENUS        44
  196.  
  197.     /* Length of `fake' input string. */
  198.  
  199. #define INPUT_LENGTH        1024
  200.  
  201.     /* Global temporary buffer size. */
  202.  
  203. #define BUFFER_LENGTH        1024
  204.  
  205.     /* Clipboard buffer length. */
  206.  
  207. #define CLIP_LENGTH        1024
  208.  
  209.     /* Game list control panel gadget IDs. */
  210.  
  211. enum    {    GAMEGAD_LIST, GAMEGAD_SELECT, GAMEGAD_CANCEL };
  212.  
  213.     /* Game levels. */
  214.  
  215. enum    {    LEVEL_INTRODUCTORY,LEVEL_STANDARD,LEVEL_ADVANCED,LEVEL_EXPERT };
  216.  
  217.     /* The number of type 3 games available. */
  218.  
  219. #define NUM_GAMES        24
  220.  
  221.     /* The script file name extension. */
  222.  
  223. #ifndef SCRIPT_EXT
  224. #define SCRIPT_EXT        ".Script"
  225. #endif    /* !SCRIPT_EXT */
  226.  
  227.     /* How many history lines to keep, change this value if you
  228.      * wish to use a different number.
  229.      */
  230.  
  231. #ifndef HISTORY_LINES
  232. #define HISTORY_LINES        20
  233. #endif    /* !HISTORY_LINES */
  234.  
  235.     /* Default terminal window dimensions. */
  236.  
  237. #ifndef WINDOW_COLUMNS
  238. #define WINDOW_COLUMNS        80
  239. #endif    /* !WINDOW_COLUMNS */
  240.  
  241. #ifndef WINDOW_LINES
  242. #define WINDOW_LINES        25
  243. #endif    /* !WINDOW_LINES */
  244.  
  245.     /* Minimum terminal window dimensions. */
  246.  
  247. #ifndef MIN_WINDOW_COLUMNS
  248. #define MIN_WINDOW_COLUMNS    40
  249. #endif    /* !MIN_WINDOW_COLUMNS */
  250.  
  251. #ifndef MIN_WINDOW_LINES
  252. #define MIN_WINDOW_LINES    10
  253. #endif    /* !MIN_WINDOW_LINES */
  254.  
  255.     /* Minimum printer page width. */
  256.  
  257. #ifndef MIN_PRINTER_COLUMNS
  258. #define MIN_PRINTER_COLUMNS    40
  259. #endif    /* !MIN_PRINTER_COLUMNS */
  260.  
  261.     /* Default story file names. */
  262.  
  263. #ifndef FNAME_LST
  264. #define FNAME_LST        {"Story",0}
  265. #endif    /* !FNAME_LST */
  266.  
  267.     /* Default story file name extensions. */
  268.  
  269. #ifndef FEXT_LST
  270. #define FEXT_LST        {"",".Dat",".Data",0}
  271. #endif    /* !FEXT_LST */
  272.  
  273.     /* A handy alias for menu flags. */
  274.  
  275. #define MENU_TICK        (CHECKIT | MENUTOGGLE)
  276.  
  277.     /* Maximum filename length, including full path. */
  278.  
  279. #define MAX_FILENAME_LENGTH    256
  280.  
  281.     /* Maximum AmigaDOS file name length (dreaded BCPL artefact). */
  282.  
  283. #define AMIGADOS_NAME_LIMIT    31
  284.  
  285.     /* The length of the ".Save" file name suffix. */
  286.  
  287. #define SAVE_SUFFIX_LENGTH    5
  288.  
  289.     /* The ".Save" file suffix. */
  290.  
  291. #define SAVE_SUFFIX        ".Save"
  292.  
  293.     /* Stopwatch mouse pointer size and offsets. */
  294.  
  295. #define STOPWATCH_HEIGHT    16
  296. #define STOPWATCH_WIDTH        0
  297. #define STOPWATCH_LEFT_OFFSET    -6
  298. #define STOPWATCH_TOP_OFFSET    0
  299.  
  300.     /* Minimum system software revision required. */
  301.  
  302. #define LIB_VERSION        37
  303.  
  304.     /* Control sequence introducer. */
  305.  
  306. #define TERM_CSI        0x9B
  307.  
  308.     /* Backspace character. */
  309.  
  310. #define TERM_BS            '\b'
  311.  
  312.     /* Delete character. */
  313.  
  314. #define TERM_DEL        0x7F
  315.  
  316.     /* Return character. */
  317.  
  318. #define TERM_CR            '\r'
  319.  
  320.     /* Control-X, clear the input line. */
  321.  
  322. #define TERM_CUT        0x18
  323.  
  324.     /* Control-\, equivalent to hitting the window
  325.      * close gadget.
  326.      */
  327.  
  328. #define TERM_CLOSE        0x1C
  329.  
  330.     /* Control-A, moves cursor to beginning of line. */
  331.  
  332. #define TERM_BEGIN        0x01
  333.  
  334.     /* Control-Z, moves cursor to end of line. */
  335.  
  336. #define TERM_END        0x1A
  337.  
  338.     /* Control-W, deletes the word to the left of the cursor. */
  339.  
  340. #define TERM_DELWORD        0x17
  341.  
  342.     /* Control-K, delete everything from the cursor forward to
  343.      * the end of the line.
  344.      */
  345.  
  346. #define TERM_DELFWD        0x0B
  347.  
  348.     /* Control-U, delete everything from the cursor backward
  349.      * to the start of the line.
  350.      */
  351.  
  352. #define TERM_DELBCK        0x15
  353.  
  354.     /* Control-Y, undoes previous editing action. */
  355.  
  356. #define TERM_UNDO        0x19
  357.  
  358.     /* Control-C, copies input line to clipboard. */
  359.  
  360. #define TERM_COPY        0x03
  361.  
  362.     /* Form feed, returned when window is resized. */
  363.  
  364. #define TERM_RESIZE        '\f'
  365.  
  366.     /* This is a second measured in microseconds. */
  367.  
  368. #define SECOND            1000000
  369.  
  370.     /* Audio channel bits. */
  371.  
  372. #define LEFT0F  1
  373. #define RIGHT0F  2
  374. #define RIGHT1F  4
  375. #define LEFT1F  8
  376.  
  377.     /* Three handy signal masks. */
  378.  
  379. #define SIG_WINDOW        (1L << Window -> UserPort -> mp_SigBit)
  380. #define SIG_WORKBENCH        (WorkbenchPort ? (1L << WorkbenchPort -> mp_SigBit) : NULL)
  381. #define SIG_TIME        (1L << TimePort -> mp_SigBit)
  382.  
  383.     /* Some definitions which may not yet be available in every
  384.      * include file set.
  385.      */
  386.  
  387. #ifndef GTMN_NewLookMenus
  388. #define GTMN_NewLookMenus    (GT_TagBase+67)
  389. #endif    /* !GTMN_NewLookMenus */
  390.  
  391. #ifndef WA_NewLookMenus
  392. #define WA_NewLookMenus        (WA_Dummy+0x30)
  393. #endif    /* !WA_NewLookMenus */
  394.  
  395.     /* A handle to hold command history lists and function key
  396.      * assignments.
  397.      */
  398.  
  399. struct StringBuffer
  400. {
  401.     int             sb_Len;    /* Length of the string. */
  402.     char            *sb_Buffer;    /* The string itself. */
  403. };
  404.  
  405.     /* A special node type. */
  406.  
  407. struct GameNode
  408. {
  409.     struct Node         gn_Node;    /* Vanilla Exec Node. */
  410.     char            *gn_FileName;    /* Corresponding file name. */
  411. };
  412.  
  413.     /* Local includes. */
  414.  
  415. #ifndef _AMIGA_DATA_C
  416. #include "amiga_data.h"
  417. #include "amiga_protos.h"
  418. #endif    /* _AMIGA_DATA_C */
  419.